package com.xinweisi.dataserver.util;

import java.util.ArrayList;
import java.util.List;

/**
 * DBNameUtil
 *
 * @author lijie1
 * @version 1.0
 * @date 2020/7/27 0027 11:31
 */
public class DBNameUtil {
    public static List<String> getDANameList(String startDBName ,String startTime,String endTime){
        List<String> DBNameList = new ArrayList<String>();
        String date1=startDBName.substring(startDBName.indexOf("_")+1);//起始数据库
        String date2=startTime.replace("-","");//开始数据库
        String dateStart = date2;//查询数据库起始
        String DBName;//数据库名称
        if(date2.compareTo(date1)<0){
            dateStart = date1;
        }
        String dateEnd=endTime.replace("-","");//结束数据库

        List<String> list = DateUtil.getBetweenDates(dateStart,dateEnd);//开始结束数据库集合
        for (String str:list) {
            DBName = "daylog_"+str;
            DBNameList.add(DBName);
        }
        return DBNameList;
    }
}
